# 面向过程编程
a = 1
b = 1
r = 1
a = int(input("please int a positive integer a="))
while a <= 0:
    a = int(input("Error,please int a positive integer! \n a = "))
b = int(input("please int a positive integer b="))
while b <= 0:
    b = int(input("Error,please int a positive integer! \n b = "))
if a < b:
    r = a
    a = b
    b = a
# 由def时r!=0，且if语句中无r==0可能，省略r=a%b新定义
while r != 0:
    a = b
    b = r
    r = a % b
print("{} is the Greatest Common Divisor of them".format(b))


# 函数式编程
def resort(a: int, b: int):
    r = 0
    if a < b:
        r = a
        a = b
        b = a


def gcd(a: int, b: int) -> str:
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
    return "{} is the Greatest Common Divisor of them".format(b)


a = int(input("please int a positive integer a="))
while a <= 0:
    a = int(input("Error,please int a positive integer! \n a = "))
b = int(input("please int a positive integer b="))
while b <= 0:
    b = int(input("Error,please int a positive integer! \n b = "))
resort(a, b)
print(gcd(a, b))

# 面向对象编程
#   利用元组性质创建子类后建立函数
